package com.admin.boot.modules.online.mapper;

import com.admin.boot.modules.online.entity.OnlineTable;
import com.admin.boot.modules.online.entity.OnlineTableField;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @version v3.0
 * @Description: TODO
 * @author: jeecg-boot
 * @date: 2024-01-10
 */
@Mapper
public interface OnlineTableMapper extends BaseMapper<OnlineTable> {

    void updateVersion(@Param("id") String id);

    void createTable(@Param("tableName")String tableName,@Param("createSql") String string);

    void dropTable(@Param("tableName") String tableName);

    void updateTableField(@Param("tableName")String tableName,
                          @Param("fieldName")String fieldName,
                          @Param("fieldType")String fieldType,
                          @Param("comment")String comment,
                          @Param("defaultValue")String defaultValue);

    void updateFieldName(@Param("tableName")String tableName,@Param("fieldName")String fieldName,@Param("newFieldName")String newFieldName);

    String getTableByName(String tableName);

    List<Map<String,String>> getTableFieldsByTableName(String tableName);


    void dropColumn(@Param("tableName")String tableName,
                     @Param("fieldName")String fieldName);

    void addField(@Param("tableName")String tableName,
                  @Param("fieldName")String fieldName,
                  @Param("fieldType")String fieldType,
                  @Param("comment")String comment,
                  @Param("defaultValue")String defaultValue);
}
